package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.db.Analysis;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AnalysisMapper extends BaseMapper<Analysis> {

    //累计用户数
    @Select("select sum(num_registered) from `tb_analysis` ")
    Long findCumulativeUsers();


    //查询周期内活跃用户数
    @Select("SELECT SUM(num_active) FROM `tb_analysis` WHERE record_date BETWEEN #{begin} AND #{end}")
    Long findActivePassByTime(@Param("begin") String begin, @Param("end") String end);


    @Select("SELECT * FROM `tb_analysis` WHERE record_date BETWEEN #{startTime} AND #{endTime}")
    List<Analysis> findTongJi(@Param("startTime")String startTime, @Param("endTime") String endTime);
}
